#include <string.h>
#include "DAP_config.h"
#include "DAP.h"
#include "stm32f4xx_hal.h"

// Clock Macros
#define CLOCK_DELAY(swj_clock) \
 (((CPU_CLOCK/2U) / swj_clock) - IO_PORT_WRITE_CYCLES)

//***********************************************************************
DAP_Data_t DAP_Data_1;           // DAP Data

// Setup DAP
void DAP_Setup_1(void) {

  // Default settings
  DAP_Data_1.clock_delay = CLOCK_DELAY(DAP_DEFAULT_SWJ_CLOCK);
  DAP_Data_1.transfer.idle_cycles = 0U;
  DAP_Data_1.swd_conf.turnaround  = 1U;
  DAP_Data_1.swd_conf.data_phase  = 0U;
	
  DAP_SETUP_1();  // Device specific setup
}

//***********************************************************************
DAP_Data_t DAP_Data_2;           // DAP Data

// Setup DAP
void DAP_Setup_2(void) {

  // Default settings
  DAP_Data_2.clock_delay = CLOCK_DELAY(DAP_DEFAULT_SWJ_CLOCK);
  DAP_Data_2.transfer.idle_cycles = 0U;
  DAP_Data_2.swd_conf.turnaround  = 1U;
  DAP_Data_2.swd_conf.data_phase  = 0U;
	
  DAP_SETUP_2();  // Device specific setup
}

//***********************************************************************
DAP_Data_t DAP_Data_3;           // DAP Data

// Setup DAP
void DAP_Setup_3(void) {

  // Default settings
  DAP_Data_3.clock_delay = CLOCK_DELAY(DAP_DEFAULT_SWJ_CLOCK);
  DAP_Data_3.transfer.idle_cycles = 0U;
  DAP_Data_3.swd_conf.turnaround  = 1U;
  DAP_Data_3.swd_conf.data_phase  = 0U;
	
  DAP_SETUP_3();  // Device specific setup
}







